//
// This is the Event handler for Save Button. Add your code to customize save button behavior.
//
public override void ${Button Control}_Click(object sender, ImageClickEventArgs args)
{
// Please remove the above code: SaveButton_Click_Base(sender, args) for this customization to run successfully..
// Define the URL of a page to which you want to redirect after saving the record.
String url = "../OtherPages/SomeOtherPage.aspx?Param1=1";
bool shouldRedirect = true;
try
{
// Start Transaction and save record
DbUtils.StartTransaction();
this.SaveData();
// Modify the URL to redirect to Show page
url = this.ModifyRedirectUrl(url, "");
this.CommitTransaction(sender);
}
catch (Exception ex)
{
shouldRedirect = false;
// If there is an Exception then display an alert message
BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "BUTTON_CLICK_MESSAGE", ex.Message);
this.RollBackTransaction(sender);
}
finally
{
// End Transaction
DbUtils.EndTransaction();
}
if (shouldRedirect)
{
this.ShouldSaveControlsToSession = true;
this.Page.Response.Redirect(url);
}
}
|